package com.ybkj.chat.module.dynamic.activity;

import android.app.Dialog;
import android.content.Intent;
import android.view.View;
import android.widget.RelativeLayout;

import com.ybkj.chat.R;
import com.ybkj.chat.base.BaseMvpActivity;
import com.ybkj.chat.module.dynamic.adapter.AddGroupingAdapter;
import com.ybkj.chat.ui.dialog.AddGroupDialog;
import com.ybkj.chat.ui.dialog.BaseButtonDialog;
import com.ybkj.chat.ui.view.recyclerview.XRecyclerView;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 添加分组9.10
 */

public class AddGroupActivity extends BaseMvpActivity {

    @BindView(R.id.add_group)
    RelativeLayout addGroup;
    @BindView(R.id.all_group)
    XRecyclerView xRecyclerView;

    private AddGroupingAdapter addGroupingAdapter;

    @Override
    protected void injectPresenter() {

    }

    @Override
    protected void initTitle() {
        setTitleText("添加分组");
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_add_group;
    }

    @Override
    protected void initView() {
        addGroupingAdapter = new AddGroupingAdapter(mContext);
        addGroupingAdapter.addData("1");
        addGroupingAdapter.addData("1");
        addGroupingAdapter.addData("1");
        addGroupingAdapter.addData("1");
        addGroupingAdapter.addData("1");
        addGroupingAdapter.addData("1");
        xRecyclerView.setAdapter(addGroupingAdapter);
    }

    @Override
    protected void initData() {

    }

    @OnClick({R.id.add_group, R.id.all_group})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.add_group:
                AddGroupDialog mDialog = new AddGroupDialog(mContext);
                mDialog.setCancelButtonText("取消");
                mDialog.setConfirmButtonText("添加");
                mDialog.setOnCancelButtonClickListener(new BaseButtonDialog.OnCancelButtonClickListener() {
                    @Override
                    public void cancel(Dialog dialog, View view) {
                        mDialog.dismiss();
                    }
                });
                mDialog.setOnConfirmButtonClickListener(new BaseButtonDialog.OnConfirmButtonClickListener() {
                    @Override
                    public void confirm(Dialog dialog, View view) {
                        mDialog.dismiss();
                        Intent intent = new Intent(mContext, ChooseFriendActivity.class);
                        intent.putExtra("GroupName", mDialog.getContent());
                        com.ybkj.chat.manager.ActivityManager.gotoActivity(mContext, intent);
                    }
                });
                mDialog.show();
                break;
            case R.id.all_group:
                break;
        }
    }
}
